﻿using System;
using System.Web;

namespace ERP.Manager.Core
{
    public interface ISessionProvider
    {
        object Get(string key);
        void Set(string key, object value);
        void Abandon();
        void RemoveAll();
    }

    public class DefaultSessionProvider : ISessionProvider
    {

        public object Get(string key)
        {
            return HttpContext.Current.Session[key];
        }

        public void Set(string key, object value)
        {
            HttpContext.Current.Session[key] = value;
        }

        public void Abandon()
        {
            HttpContext.Current.Session.Abandon();
        }

        public void RemoveAll()
        {
            HttpContext.Current.Session.RemoveAll();
        }
    }
}
